[show interfaces] "show interfaces flap" command does not support multi-ASIC platforms#4316
Conversation
…ti-ASIC platforms - Added multi-ASIC support for namespace and display filtering - Added multi-ASIC tests in tests/flap_test.py Signed-off-by: Pavan Kalyan Nakka <pnakka@microsoft.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR updates the SONiC show interfaces flap CLI to work on multi-ASIC systems by adding standard multi-ASIC options and aggregating flap data across namespaces, along with new multi-ASIC-focused unit tests and mock DB data.
Changes:
- Add
-n/--namespaceand-d/--displaysupport toshow interfaces flapusingmulti_asic_click_options. - Update the command implementation to iterate namespaces and collect flap data from each ASIC’s APPL_DB.
- Add multi-ASIC flap mock data and introduce a new multi-ASIC unit test file.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| show/interfaces/init.py | Adds multi-ASIC options to flap and aggregates flap data across namespaces/APP_DB instances. |
| tests/flap_test.py | Adds new unit tests for multi-ASIC show interfaces flap behavior. |
| tests/mock_tables/asic0/appl_db.json | Adds flap fields to asic0 PORT_TABLE mock data. |
| tests/mock_tables/asic1/appl_db.json | Adds flap fields to asic1 PORT_TABLE mock data. |
Signed-off-by: Pavan Kalyan Nakka <pnakka@microsoft.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
Commenter does not have sufficient privileges for PR 4316 in repo sonic-net/sonic-utilities |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Pavan Kalyan Nakka <pnakka@microsoft.com>
c135e0e to
7e7f4f2
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
doc/Command-Reference.md
Outdated
| Ethernet8 4035 Up Up Sat Feb 21 11:00:41 2026 Sat Feb 21 11:00:59 2026 | ||
| Ethernet16 4015 Up Up Sat Feb 21 11:01:23 2026 Sat Feb 21 11:01:41 2026 | ||
| ``` | ||
| - Example (to only display flap count for interface Ethernet0): |
Signed-off-by: Pavan Kalyan Nakka <pnakka@microsoft.com>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
||
| # Display the formatted table | ||
| click.echo(tabulate(body, header)) | ||
|
|
There was a problem hiding this comment.
@pnakka28 db connection does not need to be closed at the end?
There was a problem hiding this comment.
@prgeor the original implementation used SonicV2Connector to open and close db connection. For multi-ASIC support, I switched to multi_asic.connect_to_all_dbs_for_ns() from sonic_py_common, following the same pattern as the existing mpls command. This helper manages db connections internally and other commands using it do not explicitly open or close the db connection.
What I did
Added multi-ASIC platform support for
show interfaces flapcommandHow I did it
multi_asic_click_optionsdecorator to support-n/--namespaceand-d/--displayoptionsasic0/appl_db.json,asic1/appl_db.json)tests/flap_test.pyHow to verify it
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)